<template>
    <h2>跟踪记录</h2>
    <div>
        <p>合同编号：{{ GetContractedinfo.contractNumber }}</p>
        <p>收货地址：{{ TRBackFillLinelist.startingPoint }}</p>
    </div>
    <hr>
    <el-timeline style="max-width: 600px">
        <el-timeline-item v-for="inde in dateFrom" placement="top">
            <el-card>
                <h4>{{ inde.header }}</h4>
                <p v-if="inde.carrier != null">承运商:{{ inde.carrier }}</p>
                <p v-if="inde.responsiblePerson != null">经办人:{{ inde.responsiblePerson }}</p>
                <p v-if="inde.approver != null">审批人:{{ inde.approver }}</p>
                <p v-if="inde.consignee != null">收货人:{{ inde.consignee }}</p>
                <p v-if="inde.phone != null">电话:{{ inde.phone }}</p>
                <p v-if="inde.remark != null">说明:{{ inde.remark }}</p>
                <p v-if="inde.createDate != null">当前时间:{{ inde.createDate.substring(0, 10) }}&nbsp;{{
                    inde.createDate.substring(11, 19) }}</p>
            </el-card>
        </el-timeline-item>
    </el-timeline>
</template>

<script setup lang='ts'>
import { ref, onMounted } from 'vue'
import axios from 'axios'
import { useRoute, useRouter } from 'vue-router'
import { number } from 'echarts';
const route = useRoute()


onMounted(() => {
    //货主合同查看详情
    GetContracted()
})
//货主合同查看详情
const GetContractedinfo: any = ref({})
const GetContracted = () => {
    let id = route.query.id
    axios.get('ContractRead/api/ReadContract/GetContracted', {
        params: {
            contractId: id
        }
    }).then((ret) => {
        console.log(ret.data.data)
        GetContractedinfo.value = ret.data.data
        TRBackFillLine()
        TrackRecord()
    })
}

//显示路线
const TRBackFillLinelist: any = ref([])
const TRBackFillLine = () => {
    axios.get('FoundationRead/api/Foundation/TRBackFillLine', {
        params: {
            lineName: GetContractedinfo.value.line
        }
    }).then((ret) => {
        console.log(ret.data.data)
        TRBackFillLinelist.value = ret.data.data[0]
    })
}
//记录
const dateFrom: any = ref([])
const TrackRecord = () => {
    axios.get("ContractRead/api/TrackRecord?ContractNumber=" + GetContractedinfo.value.contractNumber).then(res => {
        dateFrom.value = res.data.data
    }).catch(err => {
        console.log(err)
    })
}


</script>

<style></style>